Skip to content

build(ENG-12825): migrate packaging to uv + pyproject.toml#317

Draft
BartoszBlizniak wants to merge 6 commits into
masterfrom
eng-12825-migrate-cli-packaging-to-uv-pyprojecttoml
Draft

build(ENG-12825): migrate packaging to uv + pyproject.toml#317
BartoszBlizniak wants to merge 6 commits into
masterfrom
eng-12825-migrate-cli-packaging-to-uv-pyprojecttoml

Conversation

@BartoszBlizniak

Copy link
Copy Markdown
Member

Description

Migrate CLI packaging to pyproject.toml + uv (with a locked uv.lock) as a single source of truth, replacing setup.py, setup.cfg, and requirements.{in,txt}. CI (test.yml, lint.yml) now runs through uv. No change to CLI behaviour.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe)

Additional Notes

  • Build/packaging only — the CLI is unchanged; uv build produces the same wheel + sdist.
  • requirements.txt is removed; uv export regenerates a pinned list if a consumer needs one.
  • Groundwork for distributing the CLI as a standalone binary.

@BartoszBlizniak BartoszBlizniak changed the title build: migrate packaging to uv + pyproject.toml build(ENG-12825): migrate packaging to uv + pyproject.toml Jun 19, 2026
@BartoszBlizniak BartoszBlizniak requested a review from Copilot June 19, 2026 12:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the CLI’s packaging and dependency management from setup.py/setup.cfg + requirements.{in,txt} to pyproject.toml with uv.lock as the lockfile source of truth, and updates CI/dev bootstrap to use uv accordingly.

Changes:

  • Replaces legacy packaging/requirements files with a pyproject.toml-based build and uv dependency groups/lockfile workflow.
  • Updates GitHub Actions CI (tests + lint) and local direnv bootstrap (.envrc) to install/run via uv.
  • Adds prompt unstyling for Click confirm prompts in non-TTY contexts and adjusts tests for newer Click behavior / contextmanager formatting.

Reviewed changes

Copilot reviewed 16 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
setup.py Removed legacy setuptools packaging entrypoint in favor of pyproject.toml.
setup.cfg Removed legacy wheel/pytest/coverage configuration now represented in pyproject.toml.
requirements.txt Removed pip-tools compiled lockfile; uv.lock becomes the pinned source of truth.
requirements.in Removed dev dependency input file; dev deps move to pyproject.toml dependency groups.
pyproject.toml New packaging/build configuration, dependencies, and pytest/coverage config in one place.
CONTRIBUTING.md Updates contributor setup instructions to reference uv + pyproject.toml/uv.lock.
cloudsmith_cli/core/tests/test_generic_detector.py Makes environment detection test resilient by disabling AWS detector in context.
cloudsmith_cli/core/tests/test_detector_controls.py Refactors multi-patch with statement into modern parenthesized form.
cloudsmith_cli/cli/utils.py Adds maybe_unstyle_prompt() and routes confirmation prompts through it.
cloudsmith_cli/cli/tests/commands/test_tokens.py Refactors stacked patch() calls into parenthesized with form.
cloudsmith_cli/cli/tests/commands/test_metadata.py Adjusts assertion to unstyle output to avoid ANSI-split substrings.
cloudsmith_cli/cli/tests/commands/test_mcp.py Refactors stacked patch() calls into parenthesized with form.
cloudsmith_cli/cli/tests/commands/test_check.py Refactors stacked patch() calls into parenthesized with form.
AGENTS.md Updates agent/dev guidance to reflect uv/pyproject.toml/uv.lock.
.github/workflows/test.yml Switches matrix test job setup/install/run steps from pip to uv.
.github/workflows/lint.yml Consolidates linting into a single uv + pre-commit job and adds concurrency control.
.envrc Updates local bootstrap to uv sync --locked --group dev instead of pip/requirements files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyproject.toml
Comment thread pyproject.toml
Comment thread pyproject.toml
Comment thread AGENTS.md Outdated
- release.yml: replace `python setup.py sdist bdist_wheel` with `uv build`
  in both the build and publish-pypi jobs (setup.py was removed); add
  `astral-sh/setup-uv` steps (with caching disabled to satisfy zizmor's
  cache-poisoning audit on this tag-triggered publishing workflow); correct
  the pushed wheel filename from `*-py2.py3-none-any.whl` to
  `*-py3-none-any.whl` to match the new build output.
- AGENTS.md: drop the reference to `packaging/constraints.txt`, which does
  not exist on this branch (it belongs to the separate binary-build work),
  keeping only the accurate pyproject.toml + uv.lock guidance.

Declined (with evidence):
- pyproject.toml license string: PEP 639 SPDX string `license = "Apache-2.0"`
  is valid for setuptools 82.0.1; `uv build` succeeds and emits
  `License-Expression: Apache-2.0` in METADATA.
- Apache license classifier: PEP 639 supersedes license classifiers; adding
  it makes setuptools 82.0.1 raise InvalidConfigError and breaks the build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cloudsmith-iduffy cloudsmith-iduffy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small questions but nothing blocking.

Comment thread .github/workflows/release.yml
Comment thread cloudsmith_cli/cli/utils.py
BartoszBlizniak and others added 3 commits July 8, 2026 15:38
Transitive dependency via mcp. Versions >=2.12.0,<2.14.2 allow
NestedSecretsSettingsSource to follow symlinks outside secrets_dir.
pip-audit against the exported lock is clean and the test suite passes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The prompt-through-input() change that bypasses ANSI stripping landed in
click 8.4 (_readline_prompt), not 8.2. Verified empirically: the styled
prompt leaks ANSI in captured output on 8.4.0/8.4.1 but not 8.1.8-8.3.1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Answers PR #317 review question. test.yml and lint.yml keep
enable-cache: true where caching actually pays off.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BartoszBlizniak added a commit that referenced this pull request Jul 8, 2026
Review feedback on #318: with the uv migration (#317) in the base branch,
install everything from the locked binary dependency group instead of pip
plus an exported constraints file:

- native/alpine/glibc builds now use uv sync --locked --no-dev
  --no-editable --group binary --extra all and uv run --no-sync
  pyinstaller. --no-editable matters: the default editable install
  leaves cloudsmith_cli out of site-packages, so PyInstaller cannot
  bundle it (the frozen binary fails with ModuleNotFoundError);
  a non-editable install matches the previous pip behavior.
- container builds install a pinned uv (UV_VERSION) with
  UV_PYTHON_DOWNLOADS=never so they keep building against the image's
  system Python (preserving the glibc 2.28 floor on almalinux 8).
- drop packaging/constraints.txt, its pre-commit sync hook, the CI
  export/cmp gate, and the AGENTS.md reference — uv.lock is now the
  single source of pins.

Verified locally on macOS arm64: uv sync + uv run pyinstaller from the
workflow commands, then --version and packaging/smoketest.sh offline
against the built dist all pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants